package com.gxar.quick.ar.server.base.controller;

import com.gxar.common.entity.Result;
import com.gxar.common.entity.login.LoginUserThread;
import com.gxar.common.entity.login.UserProfile;
import com.gxar.quick.ar.server.base.model.slot.vo.request.SlotBuyRequest;
import com.gxar.quick.ar.server.base.model.slot.vo.response.SlotBuyResponse;
import com.gxar.quick.ar.server.base.model.slot.vo.response.SlotCheckRightsResponse;
import com.gxar.quick.ar.server.db.service.SlotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 坑位接口
 *
 * @author linsy
 * @version 1.0
 * @created 2023/11/3 15:44
 */
@Api(tags = "坑位接口")
@RestController
@RequestMapping("/api/slots")
@RequiredArgsConstructor
@Slf4j
public class SlotController {

    private final SlotService slotService;

    @ApiOperation("购买坑位")
    @PostMapping("/buy")
    public Result<SlotBuyResponse> slotBuy(@RequestBody SlotBuyRequest slotBuyRequest) {
        UserProfile userProfile = LoginUserThread.get();
        return slotService.slotBuy(userProfile, slotBuyRequest);
    }

}
